Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nx-cugraph: add NX_CUGRAPH_AUTOCONFIG=True env var to enable full zero-code change #4685

Merged
merged 3 commits into from
Oct 7, 2024

Conversation

eriknw
Copy link
Contributor

@eriknw eriknw commented Oct 1, 2024

This is for convenience and sets or updates NETWORKX environment variables.

Do we like NX_CUGRAPH as the env var name? What should we consider a true value: "True" (case-insensitive) or a non-empty value?

This works with the latest dev version of NetworkX. I have not yet tried it with older NetworkX versions.

…change

This is for convenience and sets or updates NETWORKX environment variables.
@eriknw eriknw requested a review from a team as a code owner October 1, 2024 17:22
@github-actions github-actions bot added the python label Oct 1, 2024
Copy link
Contributor

@rlratzel rlratzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think the choices of what/how to update here is good, especially the (untested) support for older versions.

I do have a few requests, questions, and concerns:

  • Since this has a lot of potentially surprising side effects, I think the env var name should be less ambiguous (as you also wondered). I'd say NX_CUGRAPH_AUTOCONFIG is much more self-documenting.
  • I think the value should be True/true/TRUE instead of just non-empty. I think that matches NetworkX too? Either way, I'd hate someone to set it to False and have it evaluate to True because it's non-empty.
  • When does this get applied relative to NetworkX processing its env vars? If/when a user sets this and the standard NX vars, what wins, and is that expected?
  • concern: I hope this doesn't set a precedent for other backends, since I can already see multiple backends with their own presets clobber each other in fun and mysterious ways. I hope this shows that these can be the expected defaults and we can get back to one env var: NETWORKX_BACKEND_PRIORITY.
  • Unfortunately, I think we need this preset. Early feedback from new users helping with docs indicate that the 3 vars NX now requires for full ZCC is this close 🤏 to being a non-starter.

@rlratzel rlratzel added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Oct 1, 2024
@eriknw
Copy link
Contributor Author

eriknw commented Oct 1, 2024

Thanks for the quick feedback.

  • Since this has a lot of potentially surprising side effects, I think the env var name should be less ambiguous (as you also wondered). I'd say NX_CUGRAPH_AUTOCONFIG is much more self-documenting.

👍 I updated it to that. I want "AUTO" in the variable name as well.

  • I think the value should be True/true/TRUE instead of just non-empty. I think that matches NetworkX too? Either way, I'd hate someone to set it to False and have it evaluate to True because it's non-empty.

Yeah, I think this generally matches networkx.

  • When does this get applied relative to NetworkX processing its env vars? If/when a user sets this and the standard NX vars, what wins, and is that expected?

nx-cugraph's get_info (which updates the env vars) gets called here:
https://github.com/networkx/networkx/blob/74af3e63d21406680ae21a60975135472d3ca412/networkx/utils/backends.py#L415
which is before handling of the environment variables here (when importing .configs):
https://github.com/networkx/networkx/blob/74af3e63d21406680ae21a60975135472d3ca412/networkx/utils/backends.py#L423-L424
and here:
https://github.com/networkx/networkx/blob/74af3e63d21406680ae21a60975135472d3ca412/networkx/utils/backends.py#L475

  • concern: I hope this doesn't set a precedent for other backends, since I can already see multiple backends with their own presets clobber each other in fun and mysterious ways. I hope this shows that these can be the expected defaults and we can get back to one env var: NETWORKX_BACKEND_PRIORITY.

I think such an "easy-mode" environment variable should only be expected to be useful when using a single backend. I think we can get a lot of mileage out of this. But, yeah, if multiple backends start doing the same thing, clobbering and undefined behavior become possible unless the backends can coordinate. Let's see how it goes.

  • Unfortunately, I think we need this preset. Early feedback from new users helping with docs indicate that the 3 vars NX now requires for full ZCC is this close 🤏 to being a non-starter.

Yeah, one environment variable is nice.

@eriknw eriknw changed the title nx-cugraph: add NX_CUGRAPH=True env var to enable full zero-code change nx-cugraph: add NX_CUGRAPH_AUTOCONFIG=True env var to enable full zero-code change Oct 1, 2024
@rlratzel
Copy link
Contributor

rlratzel commented Oct 1, 2024

/merge

@rlratzel rlratzel added this to the 24.10 milestone Oct 1, 2024
@eriknw
Copy link
Contributor Author

eriknw commented Oct 3, 2024

I wonder whether (and when) it might make sense to introduce a RAPIDS-wise environment variable (such as RAPIDS_MAKE_THINGS_GO_BRRR=True) to automatically accelerate multiple libraries. We could support it.

@jakirkham
Copy link
Member

Updated now that PR ( #4690 ) has merged

@rapids-bot rapids-bot bot merged commit acf5029 into rapidsai:branch-24.10 Oct 7, 2024
136 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants